import 'package:flutter/material.dart';
import 'package:flutter_base/src/config/app_color_extension.dart';
import 'package:flutter_base/src/config/color_util.dart';

class AppTheme {
  // 1. 定义亮色主题
  static final ThemeData lightTheme = ThemeData(
    colorScheme: ColorScheme.fromSeed(
      seedColor: ColorUtils.primaryColor, // 你可以选择任何种子颜色
      brightness: Brightness.light,
    ),
    useMaterial3: true,
    appBarTheme: const AppBarTheme(
      backgroundColor: ColorUtils.primaryColor,
      foregroundColor: ColorUtils.whiteColor,
    ),
    scaffoldBackgroundColor: ColorUtils.backgroundColor,
    extensions: const <ThemeExtension<dynamic>>[
      AppColorExtension(
        primaryColor: Color(0xFF4053C0),
        primaryAlphaColor: Color(0x194053C0),
        backgroundColor: Color(0xFFF4F6F8),
        lineColor: Color(0xFFE1E1E1),
        textDarkColor: ColorUtils.textDarkColor,
        textColors3: Color(0xFF333333), // 亮色模式下，深色文字
        textColors6: Color(0xFF666666),
        textColors9: Color(0xFF999999),
        redColor: Color(0xFFE3483A),
        greenColor: Color(0xFF00B063),
        whiteColor: Color(0xFFFFFFFF),
      ),
    ],
  );

  // 2. 定义暗色主题
  static final ThemeData darkTheme = ThemeData(
    colorScheme: ColorScheme.fromSeed(
      seedColor: ColorUtils.primaryColor, // 种子颜色可以和亮色模式一样
      brightness: Brightness.dark,
    ),
    useMaterial3: true,
    appBarTheme: const AppBarTheme(
      backgroundColor: Colors.black38,
      foregroundColor: ColorUtils.whiteColor,
    ),
    extensions: const <ThemeExtension<dynamic>>[
      AppColorExtension(
        primaryColor: Colors.white, // 暗色模式下，主色可以更亮一些
        primaryAlphaColor: Color(0x335C6BC0),
        backgroundColor: Color(0xFF121212), // 暗色模式的背景
        lineColor: Color(0xFF424242), // 暗色模式的分隔线
        textDarkColor: ColorUtils.textDarkColor,
        textColors3: Color(0xFFE0E0E0), // 暗色模式下，浅色文字
        textColors6: Color(0xFFBDBDBD),
        textColors9: Color(0xFF9E9E9E),
        redColor: Color(0xFFEF9A9A), // 颜色可以更柔和
        greenColor: Color(0xFF81C784),
        whiteColor: Color(0xFF121212), // 在暗色模式下，“白色”背景可能也应该是深色的
      ),
    ],
  );
}
